package com.leo.component;

import com.almasb.fxgl.entity.component.Component;
import javafx.scene.paint.Color;
import javafx.scene.shape.Rectangle;

/**
 * @Author: wangss
 * @CreateTime: 2023-06-19  21:59
 * @Description: TODO
 */
public class MapComponent extends Component {

    @Override
    public void onAdded() {
        String color = entity.getString("color");
        Color webColor = Color.web(color);

        int w = entity.getInt("w");
        int h = entity.getInt("h");

        entity.getViewComponent().addChild(new Rectangle(w, h, webColor));
    }
}
